package com.xxrl.shop.domain;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;

/**
 * @author LinuY
 * @date 2020/7/31 0:47
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
@Document(indexName = "sp_product_name_and_keywords")
public class ProductIndex {

    @Id
    private String id;

    private Long productId;

    @Field(analyzer = "ik_max_word",searchAnalyzer = "ik_max_word")
    private String productName;

    @Field(analyzer = "ik_max_word",searchAnalyzer = "ik_max_word")
    private String keywords;

    public ProductIndex(String productName, String keywords, Long productId) {
        this.productName = productName;
        this.keywords = keywords;
        this.productId = productId;
    }
    public ProductIndex(String productName, String keywords) {
        this.productName = productName;
        this.keywords = keywords;
    }
}
